let state = {
    //isExit  0  未登录
    loginState:{
        isExit:0,
        user_id:'',
        token:'',
        user_name:'',
        company_id:'',
        company_name:'',
        company_pid:'',
        company_num:''
    },
    height:500,
    company_id:'',
    partScholl:{
        defaultIcon:0
    },
    device:{
        height:0,
        width:0
    }
}

let getters = {
    ratio(state) {
        return state.device.width / state.device.height
    }
}

let mutations = {
    setDevice(state,payload){
        state.device.width =payload.width;
        state.device.height =payload.height;
    },
    changeHeight(state,payload){
        state.height=payload.height;
        console.log(state.height)
    },
    changeLoginStatus(state,payload){
        // console.log(payload)
        state.loginState.isExit =payload.isExit
    },
    saveUid(state,payload){
        state.loginState.user_id =payload.uid;
        state.loginState.token =payload.token;
        state.loginState.user_name =payload.user_name;
        state.loginState.company_id=payload.company_id;
        state.loginState.company_name =payload.company_name;
        state.loginState.company_pid =payload.company_pid;
        state.loginState.company_num =payload.company_num;
    },
    getUserCompanyId(state,payload){
        state.company_id =payload.company_id
    }
}

let actions = {}

export default {
    state,
    getters,
    mutations,
    actions
}